package com.skyz.wrap.bean;

import com.hjq.toast.ToastUtils;

import java.util.Map;

public class QrCode {
    private String uid;

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    private String type;

    private Map<String,String> group;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Map<String, String> getGroup() {
        return group;
    }

    public void setGroup(Map<String, String> group) {
        this.group = group;
    }

    public String getTeamId(){
        String result = "";
        if (type!=null&&"group".equals(type)){
            if (group!=null&&group.containsKey("tid")){
               String tid = group.get("tid");
               long now =System.currentTimeMillis();
               long last = getTeamLastTime();
               if (now>last){
                   ToastUtils.show("二维码已过期");
               }else {
                   result = tid;
               }
            }
        }
        return result;

    }

    public long getTeamLastTime(){
        long result = 0l;
        if (group!=null&&group.containsKey("t")){
             try {
                 result =  Long.parseLong(group.get("t"));
             }catch (Exception e){
                 e.printStackTrace();
             }
        }
        return result;

    }
}
